package cn.edu;

import cn.edu.config.JdbcConfig;
import cn.edu.config.SpringConfig;
import cn.edu.dao.BookDao;
import cn.edu.service.BookService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @author Davey chan
 */
public class App {
    public static void main(String[] args) {

        //        等价于将配置类
        AnnotationConfigApplicationContext ctx=new AnnotationConfigApplicationContext(SpringConfig.class);
//        BookDao bookDao =  ctx.getBean(BookDao.class);
//        bookDao.update();
//        int select = bookDao.select();
//        System.out.println(select);
//        System.out.println(bookDao);
//        System.out.println(bookDao.getClass());
        BookService bean = ctx.getBean(BookService.class);
       bean.save();
//        JdbcConfig bean = ctx.getBean(JdbcConfig.class);
//        System.out.println(bean);

    }
}
